import request from '@/utils/request'
import qs from 'qs'

/**
 * 获取验证码
 */
export function getCode() {
	return request({
		url: '/code',
		method: 'get'
	})
}

/** 
 * 登录
 */
export function login(loginForm) {
	return request({
		url: '/user/login',
		method: 'post',
		data: loginForm // form表单参数
	})
}
/** 
 * 登录
 */
export function loginSms(loginForm) {
	return request({
		url: '/user/loginSms',
		method: 'post',
		data: loginForm // form表单参数
	})
}

/**
 * 注册
 */
export function register(registerForm) {
	return request({
		url: '/user/register',
		method: 'post',
		data: registerForm 
	})
}

/**
 * 添加用户
 */
export function addUser(userForm,roleId) {
	return request({
		url: '/user/addUser?roleId='+roleId,
		method: 'put',
		data: userForm 
	})
}

/**
 * 更新用户
 */
export function updateUser(userForm) {
	return request({
		url: '/user/updateUser',
		method: 'post',
		data: userForm 
	})
}

/**
 * 获取短信验证码
 */
export function checkCode(uuid,code,phone) {
	return request({
		url: `/checkCode?uuid=${uuid}&code=${code}&phone=${phone}`,
		method: 'get',
	})
}

/**
 * 获取菜单
 */
export function queryMenus() {
	return request({
		url: '/user/queryMenus',
		method: 'get',
	})
}

/**
 * 获取用户信息
 */
export function getInfo() {
	return request({
		url: '/user/getInfo',
		method: 'get',
	})
}


/**
 * 获取所有医务人员
 */
export function getAllStaff(pageNumber,pageSize,user) {
	return request({
		url: `/user/getAllStaff?pageNumber=${pageNumber}&pageSize=${pageSize}`,
		method: 'post',
		data:user,
	})
}

/**
 * 获取所有患者
 */
export function getAllPatient(pageNumber,pageSize,user) {
	return request({
		url: `/user/getAllPatient?pageNumber=${pageNumber}&pageSize=${pageSize}`,
		method: 'post',
		data:user,
	})
}
/**
 * 删除用户
 */
export function deleteUser(idList) {
	return request({
		url: '/user/deleteById',
		data: idList,
		method: 'delete'
	})
}
